package com.singleton

/**
 *
 * object声明单例
 * 饿汉式
 *@author: liushilin
 */
object Singleton {

}

/**
 * 懒汉式
 * @author: liushilin
 */
class Singleton2 private constructor() {
    companion object {
        val instance: Singleton2 by lazy { Singleton2() }
    }
    fun a(){
        print("aaa")
    }
}

fun main(args: Array<String>){
    Singleton2.instance.a();
}
